package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 * @author hua
 * @since 2024-11-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_sc_over_info_rule")
public class ScOverInfoRuleDo extends Model<ScOverInfoRuleDo> {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("over_id")
    private Long overId;

    /**
     * 计算属性
     */
    @TableField("calculate_type")
    private Integer calculateType;

    /**
     * 操作方式 大于 小于
     */
    @TableField("operate_sign")
    private Integer operateSign;

    @TableField("start_value")
    private Float startValue;

    @TableField("end_value")
    private Float endValue;

    /**
     * 国家
     */
    @TableField("country_region_codes")
    private String countryRegionCodes;

    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    /**
     * 0 并且 1或者
     */
    @TableField("rule_relation")
    private Integer ruleRelation;

//    /**
//     * cmb kg lb  cmf lb 备用
//     */
//    @TableField("unit")
//    private String unit;

    /**
     * 备用
     */
    @TableField("status")
    private Integer status;

    /**
     * 超长超重 主表id
     */
    @TableField("surcharge_rule_id")
    private Long surchargeRuleId;

    @TableField("create_time")
    private Date createTime;

    @TableField("create_by")
    private Long createBy;

    @TableField("delete_time")
    private Date deleteTime;

    @TableField("delete_by")
    private Long deleteBy;

    @TableField("update_time")
    private Date updateTime;

    @TableField("update_by")
    private Long updateBy;

    @TableField("parent_id")
    private Long parentId;

    public Double getEndValueDouble() {
        if (endValue == null) return null;
        return endValue.doubleValue();
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
